//
//  HomeLookDeliveryRangeHelper.m
//  FD
//
//  Created by xiaofang wang on 2018/11/27.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//
//查看配送范围控制器 网路请求工具类

#import "HomeLookDeliveryRangeHelper.h"
//model
#import "HomeLookDeliveryRangeModel.h"
#import "HomeCoordinateModel.h"


@implementation HomeLookDeliveryRangeHelper
+ (void)loadHomeLookDeliveryRangeDataComplection:(void (^)(NSArray * _Nonnull))complection {

    [FDHttpAPi requestHomeShopRanageListV2SuccessBlock:^(id responseObjc) {
        
        NSString *event = responseObjc[@"event"];
        NSMutableArray *newArrM = [NSMutableArray arrayWithCapacity:1];
        
        if ([event isEqualToString:SUCCESS]) { //解析数据
            
            //转模型
            NSArray *dataArr = responseObjc[@"data"];
            for (NSDictionary *dic in dataArr) {
                HomeLookDeliveryRangeModel *model = [HomeLookDeliveryRangeModel mj_objectWithKeyValues:dic];
                
                [newArrM addObject:model];
            }
            
            
            //回调结果
            if (complection) {
                complection([newArrM copy]);
            }
        }else {
            [JRToast showWithText:responseObjc[describe]];
        }
    } failureBlock:^(NSError *error) {
        FDLog(@"%@",[error localizedDescription]);
    }];
}

@end
